package com.skirmisher.inspection.common.controller;

import com.skirmisher.inspection.common.sysenum.InsJobStatusEnum;
import com.skirmisher.inspection.inspection.testController.ResponseModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName InsSysController
 * @Description TODO
 * @Author hanwangxin
 * @Date 2021/1/7 下午8:30
 * @Version 1.0
 */
@Api(tags = "巡查系统参数接口")
@RestController
@RequestMapping("/insSysController")
public class InsSysController {

    @ApiOperation(value = "任务状态码获取")
    @GetMapping(value = "/getJobStatus")
    public ResponseModel getJobStatus(){

        ResponseModel responseModel = new ResponseModel();

        InsJobStatusEnum[] values = InsJobStatusEnum.values();
        List<Map<String,Object>> list = new ArrayList<>();
        for (InsJobStatusEnum value : values) {
            Map<String,Object> map = new HashMap<>();
            Integer status = value.getStatus();
            String name = value.getName();
            map.put("key",status);
            map.put("value",name);
            list.add(map);
        }
        responseModel.setData(list);
        return  responseModel;
    }
}
